<div id="data_page" class="in_page">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline">
                <div class="form-group">
                    <label for="exampleInputName2">类型</label>

                    <select name="type"  class="form-control" >
                        <if condition="$type eq '-1'">
                            <option selected value="-1">全部</option>
                            <option value="0">收入</option>
                            <option value="1">支出</option>
                        </if>
                        <if condition="$type eq '0'">
                            <option value="-1">全部</option>
                            <option selected value="0">收入</option>
                            <option value="1">支出</option>
                        </if>
                        <if condition="$type eq '1'">
                            <option value="-1">全部</option>
                            <option value="0">收入</option>
                            <option selected value="1">支出</option>
                        </if>

                    </select>
                    <input value="1" type="hidden" name="p" class="form-control" />
                    <input value="{$model.user_id}" type="hidden" name="id" class="form-control" />
                </div>
                <button type="submit" class="btn btn-sm btn-default">搜索</button>
                <div class="btn-group">
                    <button type="reset" class="btn btn-sm btn-primary">重置</button>
                </div>
                <div style="float:right;padding-top: 5px;">
                <div class="form-group"><label>当前用户</label>：{$model.username}</div>
                <div class="form-group"><label>总余额</label>：{$model.total_balance}</div>
                <div style="color: green" class="form-group"><label>剩余余额</label>：{$model.balance}</div>
                <div  style="color: red" class="form-group"><label>使用余额</label>：{$model.use_balance}</div>
                <div  style="color: gray" class="form-group"><label>冻结余额</label>：{$model.frozen_balance}</div>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>#ID</th>
            <th>处理前余额</th>
            <th>余额数</th>
            <th>处理后余额</th>
            <th>说明</th>
            <th>添加时间</th>
        </tr>
        </thead>
        <volist name="list" id="item">
        <tr>
            <th scope="row">{$item.id}</th>
            <td>{$item.current_balance}</td>
            <td>
                <if condition="$item.type eq 0">
                    <span style="color: green">
                    +{$item.balance} （收入）
                    </span>

                </if>
                <if condition="$item.type eq 1">
                    <span style="color: red">
                    -{$item.balance} （支出）
                    </span>
                </if>
            </td>
            <td><span style="color: green">{$item.total_balance}</span></td>
            <td >{$item.description}</td>
            <td  style="text-align: center;width: 140px;">{$item.createdtime|date="Y-m-d H:i",###}</td>
        </tr>
        </volist>
    </table>
    {$page}
</div>

<script>
    function handleItem(_action,id,type){
        if(type=="add"){
            showIframe(_action+"?id="+id,"添加/扣除余额","750px","300px");
        }else if(type=="frozen"){
            showIframe(_action+"?id="+id,"冻结/解冻余额","750px");
        }else{
            showIframe(_action+"?id="+id,"查看日志","90%",'90%');
        }

    }
</script>